package com.house.controller;

import com.house.pojo.FangAdmin;
import com.house.service.FangAdminService;
import com.house.utils.R;
import com.house.vo.LoginVo;
import com.house.vo.RegisterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小贾
 * @version 1.0
 * @description: TODO
 * @date 2025/9/13 11:19
 */
@RestController
@RequestMapping("/auth/index")
public class AdminController {
    @Autowired
    FangAdminService fangAdminService;

    /**
     * @description 注册
     * @author 小贾
     * @date 2025/9/13 11:29
     * @version 1.0
     */
    @PostMapping("/register")
    public R register(@RequestBody @Validated RegisterVo registerVo){
        return fangAdminService.register(registerVo);
    }


    /**
     * @description 登录
     * @author 小贾
     * @date 2025/9/14 19:27
     * @version 1.0
     */
    @PostMapping("/login")
    public R login(@RequestBody @Validated LoginVo loginVo ){
        return fangAdminService.login(loginVo);
    }
}
